Give the GDK docs some love
authorMatthias Clasen <mclasen@redhat.com>
Wed, 9 Feb 2011 06:32:24 +0000 (01:32 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 9 Feb 2011 06:32:24 +0000 (01:32 -0500)
Reorganize some sections, drop the largely redundant multihead
section, add some more information about multiple backends.

docs/reference/gdk/Makefile.am
docs/reference/gdk/gdk-docs.sgml
docs/reference/gdk/multihead.sgml [deleted file]
gdk/gdk.c
gdk/gdkdevice.c
gdk/gdkdisplay.c
gdk/gdkdisplaymanager.c
gdk/gdkscreen.c

index 6eeffdb0d76310b32015fec360e0d535df884f04..8a70de8c1a160f1f1027e53fa7d9caf83f93f3bf 100644 (file)
@@ -51,8 +51,7 @@ MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space=gdk
 
 # Extra SGML files that are included by DOC_MAIN_SGML_FILE
 content_files =                \
-       version.xml             \
-       multihead.sgml
+       version.xml
 
 # Images to copy into HTML directory
 HTML_IMAGES =                          \
index 7be666074f3552d08d576a7b4e7314697a925416..765d26cc42647c5894d4bc3c26dca67dcda9e7b7 100644 (file)
@@ -8,21 +8,24 @@
   <bookinfo>
     <title>GDK Reference Manual</title>
     <releaseinfo>
-      for GDK &version;
-      The latest version of this documentation can be found on-line at
+      This document is for the GDK 3 library, version &version;
+      The latest version can be found online at
       <ulink role="online-location" url="http://library.gnome.org/devel/gdk/unstable/">http://library.gnome.org/devel/gdk/unstable/</ulink>.
+      If you are looking for the older GDK 2 series of libraries,
+      they can be found under their version numbers; for example,
+      2.22 is available at
+      <ulink role="online-location" url="http://library.gnome.org/devel/gdk/2.22/">http://library.gnome.org/devel/gdk/2.22/</ulink>.
     </releaseinfo>
   </bookinfo>
 
   <reference id="reference">
     <title>API Reference</title>
     <xi:include href="xml/general.xml" />
-    <xi:include href="multihead.sgml" />
-    <xi:include href="xml/gdkdisplay.xml" />
     <xi:include href="xml/gdkdisplaymanager.xml" />
-    <xi:include href="xml/gdkdevice.xml" />
-    <xi:include href="xml/gdkdevicemanager.xml" />
+    <xi:include href="xml/gdkdisplay.xml" />
     <xi:include href="xml/gdkscreen.xml" />
+    <xi:include href="xml/gdkdevicemanager.xml" />
+    <xi:include href="xml/gdkdevice.xml" />
     <xi:include href="xml/regions.xml" />
     <xi:include href="xml/pixbufs.xml" />
     <xi:include href="xml/colors.xml" />
diff --git a/docs/reference/gdk/multihead.sgml b/docs/reference/gdk/multihead.sgml
deleted file mode 100644 (file)
index 89c52cc..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
-               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
-]>
-<refentry id="multihead" revision="1 May 2002">
-  <refmeta>
-    <refentrytitle>Multi-head Support Overview</refentrytitle>
-    <manvolnum>3</manvolnum>
-    <refmiscinfo>GDK Library</refmiscinfo>
-  </refmeta>
-
-  <refnamediv>
-    <refname>Multi-head Support Overview</refname>
-    <refpurpose>Overview of GdkDisplay and GdkScreen</refpurpose>
-  </refnamediv>
-
-  <refsect1>
-    <title>Overview</title>
-      <para>
-       Multihead support is based around two main object types:
-       <itemizedlist>
-         <listitem><para>GdkDisplay</para></listitem>
-         <listitem><para>GdkScreen</para></listitem>
-       </itemizedlist>
-      </para>
-      
-      <para>
-       <link linkend="gdk-GdkDisplay">GdkDisplay</link> objects are the GDK
-       representation of the X Display which can be described as <emphasis>a
-       workstation consisting of a keyboard a pointing device (such as a
-         mouse) and one or more screens</emphasis>. 
-       It is used to open and keep track of various <link
-         linkend="gdk-GdkScreen">GdkScreen</link> objects currently 
-       instanciated by the application. It is also used to grab and release
-       the keyboard and the mouse pointer.
-      </para>
-      <para>
-       <link linkend="gdk-GdkScreen">GdkScreen</link> objects are the GDK
-       representation of a physical screen. It is used throughout GDK and GTK+
-       to specify which screen the top level windows are to be displayed on. 
-       It is also used to query the screen specification and default settings such as 
-       the default colormap (<link linkend="gdk-screen-get-default-colormap">gdk_screen_get_default_colormap</link>()),
-       the screen width (<link linkend="gdk-screen-get-width">gdk_screen_get_width</link>()), etc.
-      </para>
-      <para> 
-       The following code samples demonstrate common usage of the objects described above.
-      </para>
-      
-      <example>
-       <title>Testing the number of screen on the current display</title>
-       <programlisting><!--
--->gint num_screen = 0;
-gchar *displayname = NULL;
-GdkScreen **screen_list;
-GdkDisplay *display;
-
-gtk_init (&amp;argc, &amp;argv);
-
-display = gdk_display_get_default ();
-num_screen = gdk_display_get_n_screens (display);
-displayname = gdk_display_get_name (display);
-if (num_screen &lt;= 1)
-  {
-    printf ("This Xserver (%s) manages only one screen. exiting...\n",
-            displayname);
-    exit (1);
-  }
-else
-  {
-    printf ("This Xserver (%s) manages %d screens.\n", displayname,
-            num_screen);
-  }<!--
-
--->     </programlisting>
-      </example>
-      <example>
-       <title>Opening a second display</title>
-       <programlisting><!--
--->gchar *second_screen_name;
-GdkDisplay *second_display;
-GdkScreen *second_screen;
-GtkWidget *window;
-
-gtk_init (&amp;argc, &amp;argv);
-
-/* screen2_name needs to be initialized before calling 
-/* gdk_display_new() */
-second_display = gdk_display_new (&amp;argc, &amp;argv, second_screen_name);
-if (second_display)
-    second_screen = gdk_display_get_default_screen (second_display);
-else 
-  {
-       g_print ("Can't open display :\n\t%s\n\n",
-                 second_screen_name);
-    exit (1);  
-  }
-/* now GdkScreen can be assigned to GtkWindows */
-
-window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-gtk_window_set_screen (window, second_screen);<!--
-     --></programlisting>
-      </example>
-    </refsect1>
-    <refsect1>
-      <title>See Also</title>
-      <para>
-       <variablelist>
-         <varlistentry>
-           <term><link linkend="GdkDisplay">GdkDisplay</link></term>
-           <listitem><para>the GDK Object used to represent and manipulate display
-               related data</para></listitem>
-         </varlistentry>
-         <varlistentry>
-           <term><link linkend="GdkScreen">GdkScreen</link></term>
-           <listitem><para>the GDK Object used to represent and query screen related
-               data</para></listitem>
-         </varlistentry>
-       </variablelist>
-      </para>
-    </refsect1>
-  </refentry>
-  
-<!--
-Local variables:
-mode: sgml
-sgml-parent-document: ("gdk-docs.sgml" "book" "refentry" "")
-End:
--->
index 5182d72e2fcc238872982238bb476f036df18b7d..e65f68b3f3bc69be5dedcf89ecca79010bc6aa29 100644 (file)
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
  * The #GDK_WINDOWING_X11 macro is defined if the X11 backend
  * is supported.
  *
- * Use this macro to guard code that is specific to the X11-backend.
- * Since GDK may be configured with multiple backends, an additional
- * runtime check for the used backend is recommended:
- *
- * |[
- * #ifdef GDK_WINDOWING_X11
- *   if (GDK_IS_X11_DISPLAY (display))
- *     {
- *       /&ast; make X11-specific calls here &ast;/
- *     }
- *   else
- * #endif
- * #ifdef GDK_WINDOWING_QUARTZ
- *   if (GDK_IS_QUARTZ_DISPLAY (display))
- *     {
- *       /&ast; make Quartz-specific calls here &ast/
- *     }
- *   else
- * #endif
- *   g_error ("Unsupported GDK backend");
- * ]|
+ * Use this macro to guard code that is specific to the X11 backend.
  */
 
 /**
@@ -82,6 +62,8 @@
  *
  * The #GDK_WINDOWING_WIN32 macro is defined if the Win32 backend
  * is supported.
+ *
+ * Use this macro to guard code that is specific to the Win32 backend.
  */
 
 /**
@@ -89,6 +71,8 @@
  *
  * The #GDK_WINDOWING_QUARTZ macro is defined if the Quartz backend
  * is supported.
+ *
+ * Use this macro to guard code that is specific to the Quartz backend.
  */
 
 typedef struct _GdkPredicate  GdkPredicate;
index 2cc3ea88c95ba00edd7d9e62f68feb816edb171f..8106bea51053bb8b5e1293a11053959fb7580f42 100644 (file)
@@ -32,7 +32,8 @@
  * @Title: GdkDevice
  * @See_also: #GdkDeviceManager
  *
- * The #GdkDevice object represents a single input device.
+ * The #GdkDevice object represents a single input device, such
+ * as a keyboard, a mouse, a touchpad, etc.
  *
  * See the #GdkDeviceManager documentation for more information
  * about the various kinds of master and slave devices, and their
@@ -48,7 +49,6 @@ struct _GdkAxisInfo
 
   gdouble min_axis;
   gdouble max_axis;
-
   gdouble min_value;
   gdouble max_value;
   gdouble resolution;
index ad520b655467f084ef31fdeabb14657ecea02960..f3c4f0e778f7314b0e9748735d45fa5ff03a0fac 100644 (file)
 
 /**
  * SECTION:gdkdisplay
- * @Short_description: Controls the keyboard/mouse pointer grabs and a set of <type>GdkScreen</type>s
+ * @Short_description: Controls a set of GdkScreens and their associated input devices
  * @Title: GdkDisplay
  *
  * #GdkDisplay objects purpose are two fold:
  * <itemizedlist>
- * <listitem><para>
- *   To grab/ungrab keyboard focus and mouse pointer
- * </para></listitem>
- * <listitem><para>
- *   To manage and provide information about the #GdkScreen(s)
- *   available for this #GdkDisplay
- * </para></listitem>
+ * <listitem>
+ *   To manage and provide information about input devices (pointers
+ *   and keyboards)
+ * </listitem>
+ * <listitem>
+ *   To manage and provide information about the available #GdkScreens
+ * </listitem>
  * </itemizedlist>
  *
- * #GdkDisplay objects are the GDK representation of the X Display which can be
- * described as <emphasis>a workstation consisting of a keyboard a pointing
- * device (such as a mouse) and one or more screens</emphasis>.
- * It is used to open and keep track of various #GdkScreen objects currently
- * instanciated by the application. It is also used to grab and release the keyboard
- * and the mouse pointer.
+ * GdkDisplay objects are the GDK representation of an X Display,
+ * which can be described as <emphasis>a workstation consisting of
+ * a keyboard, a pointing device (such as a mouse) and one or more
+ * screens</emphasis>.
+ * It is used to open and keep track of various GdkScreen objects
+ * currently instantiated by the application. It is also used to
+ * access the keyboard(s) and mouse pointer(s) of the display.
+ *
+ * Most of the input device handling has been factored out into
+ * the separate #GdkDeviceManager object. Every display has a
+ * device manager, which you can obtain using
+ * gdk_display_get_device_manager().
  */
 
 
index 160404d75cdb70865f231ceb86bb78148e6f8aad..508d60910b7abe5284c05800fdcd93270d7ef2fd 100644 (file)
  * The purpose of the #GdkDisplayManager singleton object is to offer
  * notification when displays appear or disappear or the default display
  * changes.
+ *
+ * You can use gdk_display_manager_get() to obtain the GdkDisplayManager
+ * singleton, but that should be rarely necessary. Typically, initializing
+ * GTK+ opens a display that you can work with without ever accessing the
+ * GdkDisplayManager.
+ *
+ * The GDK library can be built with support for multiple backends.
+ * The GdkDisplayManager object determines which backend is used
+ * at runtime.
+ *
+ * When writing backend-specific code that is supposed to work with
+ * multiple GDK backends, you have to consider both compile time and
+ * runtime. At compile time, use the #GDK_WINDOWING_X11, #GDK_WINDOWING_WIN32
+ * macros, etc. to find out which backends are present in the GDK library
+ * you are building your application against. At runtime, use type-check
+ * macros like GDK_IS_X11_DISPLAY() to find out which backend is in use:
+ *
+ * <example id="backend-specific">
+ * <title>Backend-specific code</title>
+ * <programlisting>
+ * #ifdef GDK_WINDOWING_X11
+ *   if (GDK_IS_X11_DISPLAY (display))
+ *     {
+ *       /&ast; make X11-specific calls here &ast;/
+ *     }
+ *   else
+ * #endif
+ * #ifdef GDK_WINDOWING_QUARTZ
+ *   if (GDK_IS_QUARTZ_DISPLAY (display))
+ *     {
+ *       /&ast; make Quartz-specific calls here &ast;/
+*     }
+ *   else
+ * #endif
+ *   g_error ("Unsupported GDK backend");
+ * </programlisting>
+ * </example>
  */
 
 
@@ -168,9 +205,9 @@ gdk_display_manager_get_property (GObject      *object,
  * Gets the singleton #GdkDisplayManager object.
  *
  * When called for the first time, this function consults the
- * <envar>GDK_BACKEND</envar> to find out which of the supported
- * GDK backends to use (in case GDK has been compiled with multiple
- * backends).
+ * <envar>GDK_BACKEND</envar> environment variable to find out which
+ * of the supported GDK backends to use (in case GDK has been compiled
+ * with multiple backends).
  *
  * Returns: (transfer none): The global #GdkDisplayManager singleton;
  *     gdk_parse_args(), gdk_init(), or gdk_init_check() must have
index 4dd9164a85d28f45ad7b249a40e8f3e0cefb0db8..ebdf2c64d944760caae5d6495a9f8dbe948c2c0b 100644 (file)
  * @Short_description: Object representing a physical screen
  * @Title: GdkScreen
  *
- * #GdkScreen objects are the GDK representation of a physical screen. It is used
- * throughout GDK and GTK+ to specify which screen the top level windows
- * are to be displayed on.
- * It is also used to query the screen specification and default settings such as
- * the screen width (gdk_screen_get_width()), etc.
- *
- * Note that a screen may consist of multiple monitors which are merged to
- * form a large screen area.
+ * #GdkScreen objects are the GDK representation of the screen on
+ * which windows can be displayed and on which the pointer moves.
+ * X originally identified screens with physical screens, but
+ * nowadays it is more common to have a single #GdkScreen which
+ * combines several physical monitors (see gdk_screen_get_n_monitors()).
+ *
+ * GdkScreen is used throughout GDK and GTK+ to specify which screen
+ * the top level windows are to be displayed on. it is also used to
+ * query the screen specification and default settings such as
+ * the default visual (gdk_screen_get_system_visual()), the dimensions
+ * of the physical monitors (gdk_screen_get_monitor_geometry()), etc.
  */